﻿namespace Front._1127;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_FormClosing(object sender, FormClosingEventArgs e){
    using var connection = new MySqlConnection("Server=myserver;User ID=mylogin;Password=mypass;Database=mydatabase");
    connection.Open();

    using var command = new MySqlCommand("SELECT field FROM table;", connection);
        using var reader = command.ExecuteReader();
        while (reader.Read())
    Console.WriteLine(reader.GetString(0));
}